From 9292c94f007458064784b94b901accc7b3ec27d9 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 22 Oct 2010 15:14:51 +0100 Subject: [PATCH] libxc: convert watchdog interface over to hypercall buffers Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- tools/libxc/xc_domain.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index aada28bbde..e41f773745 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -374,24 +374,25 @@ int xc_watchdog(xc_interface *xch, uint32_t timeout) { int ret = -1; - sched_watchdog_t arg; DECLARE_HYPERCALL; + DECLARE_HYPERCALL_BUFFER(sched_watchdog_t, arg); - hypercall.op = __HYPERVISOR_sched_op; - hypercall.arg[0] = (unsigned long)SCHEDOP_watchdog; - hypercall.arg[1] = (unsigned long)&arg; - arg.id = id; - arg.timeout = timeout; - - if ( lock_pages(xch, &arg, sizeof(arg)) != 0 ) + arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); + if ( arg == NULL ) { - PERROR("Could not lock memory for Xen hypercall"); + PERROR("Could not allocate memory for xc_watchdog hypercall"); goto out1; } + hypercall.op = __HYPERVISOR_sched_op; + hypercall.arg[0] = (unsigned long)SCHEDOP_watchdog; + hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg); + arg->id = id; + arg->timeout = timeout; + ret = do_xen_hypercall(xch, &hypercall); - unlock_pages(xch, &arg, sizeof(arg)); + xc_hypercall_buffer_free(xch, arg); out1: return ret; -- 2.30.2